namespace D5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            var size = new Size(20, 20);
            var count = 40;
            for (int i = 0; i < count; i++)
            {
                for (int j = 0; j < count; j++)
                {
                    Button button = new Button
                    {
                        Location = new Point(j * size.Width, i * size.Height),
                        Size = size
                    };
                    this.Controls.Add(button);
                }
            }
        }
    }
}